<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>红包详情 - 社交红包</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #FF5252;
            --secondary: #FFD700;
            --light: #FFF8E1;
            --dark: #E63946;
            --gray: #757575;
            --light-gray: #F5F5F5;
            --border-radius: 12px;
            --card-shadow: 0 3px 10px rgba(255, 82, 82, 0.15);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: #F9F9F9;
            color: #333;
            padding-top: 56px;
            padding-bottom: 60px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 56px;
            background-color: white;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 16px;
            z-index: 1000;
            box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        }
        
        .nav-title {
            font-size: 18px;
            font-weight: 600;
            color: #333;
        }
        
        .nav-btn {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: none;
            border: none;
            color: #333;
            font-size: 20px;
        }
        
        /* 红包详情容器 */
        .redpack-detail {
            background-color: white;
            margin-bottom: 12px;
            border-radius: var(--border-radius);
            overflow: hidden;
            box-shadow: var(--card-shadow);
        }
        
        /* 红包头部信息 */
        .redpack-header {
            padding: 16px;
            display: flex;
            align-items: center;
            border-bottom: 1px solid #eee;
        }
        
        .sender-avatar {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            object-fit: cover;
            margin-right: 12px;
        }
        
        .sender-info {
            flex: 1;
        }
        
        .sender-name {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 2px;
        }
        
        .redpack-meta {
            font-size: 12px;
            color: var(--gray);
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        /* 红包内容区域 */
        .redpack-content {
            padding: 20px 16px;
        }
        
        /* 普通红包样式 */
        .normal-redpack .redpack-content {
            background: linear-gradient(135deg, #FF5252, #E63946);
            color: white;
            text-align: center;
            padding: 30px 16px;
        }
        
        .redpack-amount {
            font-size: 40px;
            font-weight: 700;
            margin: 10px 0;
        }
        
        .redpack-message {
            font-size: 18px;
            margin-bottom: 10px;
        }
        
        /* 拼手气红包详情 */
        .lucky-redpack .redpack-summary {
            display: flex;
            justify-content: space-between;
            padding: 16px;
            border-bottom: 1px solid #eee;
        }
        
        .summary-item {
            text-align: center;
        }
        
        .summary-label {
            font-size: 13px;
            color: var(--gray);
            margin-bottom: 4px;
        }
        
        .summary-value {
            font-size: 16px;
            font-weight: 600;
        }
        
        .summary-value.highlight {
            color: var(--primary);
        }
        
        /* 红包领取列表 */
        .redpack-list {
            max-height: 300px;
            overflow-y: auto;
        }
        
        .recipient-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 16px;
            border-bottom: 1px solid #eee;
        }
        
        .recipient-info {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .recipient-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: var(--light);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            color: var(--dark);
        }
        
        .recipient-name {
            font-size: 15px;
        }
        
        .recipient-time {
            font-size: 12px;
            color: var(--gray);
        }
        
        .recipient-amount {
            font-size: 16px;
            font-weight: 600;
            color: var(--primary);
        }
        
        .recipient-self .recipient-name {
            color: var(--primary);
            font-weight: 500;
        }
        
        /* 操作按钮区域 */
        .action-buttons {
            display: flex;
            padding: 16px;
            gap: 10px;
            background-color: white;
            border-top: 1px solid #eee;
        }
        
        .action-btn {
            flex: 1;
            padding: 10px;
            border-radius: 8px;
            font-size: 15px;
            font-weight: 500;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            border: none;
        }
        
        .primary-btn {
            background-color: var(--primary);
            color: white;
        }
        
        .secondary-btn {
            background-color: var(--light-gray);
            color: #333;
        }
        
        /* 留言区域 */
        .comments-section {
            background-color: white;
            border-radius: var(--border-radius);
            padding: 16px;
            margin-bottom: 12px;
            box-shadow: var(--card-shadow);
        }
        
        .section-title {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 16px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        /* 留言输入框 */
        .comment-input-container {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
        }
        
        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .comment-input {
            flex: 1;
            border: 1px solid #eee;
            border-radius: 20px;
            padding: 10px 16px;
            font-size: 14px;
            background-color: var(--light-gray);
        }
        
        .send-btn {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background-color: var(--primary);
            color: white;
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        /* 留言列表 */
        .comments-list {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }
        
        .comment-item {
            display: flex;
            gap: 10px;
        }
        
        .comment-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
            flex-shrink: 0;
        }
        
        .comment-content {
            flex: 1;
        }
        
        .comment-header {
            display: flex;
            justify-content: space-between;
            margin-bottom: 4px;
        }
        
        .comment-author {
            font-size: 14px;
            font-weight: 500;
        }
        
        .comment-time {
            font-size: 12px;
            color: var(--gray);
        }
        
        .comment-text {
            font-size: 14px;
            background-color: var(--light-gray);
            padding: 10px 14px;
            border-radius: 16px;
            border-top-left-radius: 4px;
            margin-bottom: 6px;
        }
        
        .comment-actions {
            display: flex;
            gap: 16px;
            font-size: 12px;
        }
        
        .comment-action {
            color: var(--gray);
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        .comment-action:hover {
            color: var(--primary);
        }
        
        /* 回复样式 */
        .replies {
            margin-left: 24px;
            margin-top: 10px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        
        .reply-item {
            display: flex;
            gap: 8px;
        }
        
        .reply-text {
            font-size: 13px;
            background-color: var(--light-gray);
            padding: 8px 12px;
            border-radius: 14px;
            border-top-left-radius: 4px;
        }
        
        .reply-highlight {
            color: var(--primary);
            font-weight: 500;
        }
        
        /* 底部操作栏 */
        .bottom-bar {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background-color: white;
            padding: 8px 16px;
            display: flex;
            align-items: center;
            gap: 10px;
            border-top: 1px solid #eee;
            z-index: 900;
        }
        
        .bottom-input {
            flex: 1;
            border: 1px solid #eee;
            border-radius: 20px;
            padding: 8px 16px;
            font-size: 14px;
        }
        
        .bottom-action {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--gray);
        }
        
        .bottom-action.primary {
            color: var(--primary);
        }
        
        /* 动画效果 */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .comment-item {
            animation: fadeIn 0.3s ease;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-btn" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">红包详情</div>
        <button class="nav-btn" id="moreBtn">
            <i class="fas fa-ellipsis-h"></i>
        </button>
    </div>
    
    <!-- 红包详情 -->
    <div class="redpack-detail lucky-redpack">
        <!-- 红包头部信息 -->
        <div class="redpack-header">
            <img src="https://picsum.photos/id/65/100/100" alt="发送者头像" class="sender-avatar">
            <div class="sender-info">
                <div class="sender-name">公司年会群</div>
                <div class="redpack-meta">
                    <span>王总 发送</span>
                    <span>·</span>
                    <span>今天 18:45</span>
                </div>
            </div>
        </div>
        
        <!-- 红包内容 -->
        <div class="redpack-content">
            <div class="redpack-message">年会福利，大家抢起来！</div>
        </div>
        
        <!-- 红包统计摘要 -->
        <div class="redpack-summary">
            <div class="summary-item">
                <div class="summary-label">总金额</div>
                <div class="summary-value highlight">¥100.00</div>
            </div>
            <div class="summary-item">
                <div class="summary-label">红包个数</div>
                <div class="summary-value">20个</div>
            </div>
            <div class="summary-item">
                <div class="summary-label">已领取</div>
                <div class="summary-value">18个</div>
            </div>
            <div class="summary-item">
                <div class="summary-label">你的红包</div>
                <div class="summary-value highlight">¥8.88</div>
            </div>
        </div>
        
        <!-- 红包领取列表 -->
        <div class="redpack-list">
            <div class="recipient-item recipient-self">
                <div class="recipient-info">
                    <div class="recipient-avatar">你</div>
                    <div>
                        <div class="recipient-name">你</div>
                        <div class="recipient-time">18:46 领取</div>
                    </div>
                </div>
                <div class="recipient-amount">¥8.88</div>
            </div>
            
            <div class="recipient-item">
                <div class="recipient-info">
                    <div class="recipient-avatar">王</div>
                    <div>
                        <div class="recipient-name">王总</div>
                        <div class="recipient-time">18:45 领取</div>
                    </div>
                </div>
                <div class="recipient-amount">¥12.50</div>
            </div>
            
            <div class="recipient-item">
                <div class="recipient-info">
                    <div class="recipient-avatar">李</div>
                    <div>
                        <div class="recipient-name">李姐</div>
                        <div class="recipient-time">18:47 领取</div>
                    </div>
                </div>
                <div class="recipient-amount">¥5.20</div>
            </div>
            
            <div class="recipient-item">
                <div class="recipient-info">
                    <div class="recipient-avatar">赵</div>
                    <div>
                        <div class="recipient-name">小赵</div>
                        <div class="recipient-time">18:48 领取</div>
                    </div>
                </div>
                <div class="recipient-amount">¥3.66</div>
            </div>
            
            <div class="recipient-item">
                <div class="recipient-info">
                    <div class="recipient-avatar">孙</div>
                    <div>
                        <div class="recipient-name">老孙</div>
                        <div class="recipient-time">18:49 领取</div>
                    </div>
                </div>
                <div class="recipient-amount">¥6.88</div>
            </div>
        </div>
        
        <!-- 操作按钮 -->
        <div class="action-buttons">
            <button class="action-btn secondary-btn">
                <i class="fas fa-share-alt"></i> 分享
            </button>
            <button class="action-btn secondary-btn">
                <i class="fas fa-history"></i> 记录
            </button>
            <button class="action-btn primary-btn">
                <i class="fas fa-red-envelope"></i> 发红包
            </button>
        </div>
    </div>
    
    <!-- 留言区域 -->
    <div class="comments-section">
        <div class="section-title">
            <i class="fas fa-comments"></i> 红包留言 (12)
        </div>
        
        <!-- 留言输入框 -->
        <div class="comment-input-container">
            <img src="https://picsum.photos/id/237/100/100" alt="你的头像" class="user-avatar">
            <input type="text" class="comment-input" placeholder="说点什么...">
            <button class="send-btn">
                <i class="fas fa-paper-plane"></i>
            </button>
        </div>
        
        <!-- 留言列表 -->
        <div class="comments-list">
            <div class="comment-item">
                <img src="https://picsum.photos/id/65/100/100" alt="用户头像" class="comment-avatar">
                <div class="comment-content">
                    <div class="comment-header">
                        <div class="comment-author">王总</div>
                        <div class="comment-time">18:45</div>
                    </div>
                    <div class="comment-text">大家辛苦了，年会福利提前发！</div>
                    <div class="comment-actions">
                        <div class="comment-action">
                            <i class="fas fa-heart"></i> 18
                        </div>
                        <div class="comment-action reply-btn">
                            <i class="fas fa-reply"></i> 回复
                        </div>
                    </div>
                    
                    <!-- 回复 -->
                    <div class="replies">
                        <div class="reply-item">
                            <img src="https://picsum.photos/id/91/100/100" alt="回复者头像" class="comment-avatar">
                            <div class="comment-content">
                                <div class="reply-text">
                                    <span class="reply-highlight">@王总</span> 谢谢王总！
                                </div>
                                <div class="comment-actions">
                                    <div class="comment-action">
                                        <i class="fas fa-heart"></i> 5
                                    </div>
                                    <div class="comment-action reply-btn">
                                        <i class="fas fa-reply"></i> 回复
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="comment-item">
                <img src="https://picsum.photos/id/237/100/100" alt="用户头像" class="comment-avatar">
                <div class="comment-content">
                    <div class="comment-header">
                        <div class="comment-author">你</div>
                        <div class="comment-time">18:46</div>
                    </div>
                    <div class="comment-text">谢谢老板！新年快乐！</div>
                    <div class="comment-actions">
                        <div class="comment-action">
                            <i class="fas fa-heart"></i> 3
                        </div>
                        <div class="comment-action reply-btn">
                            <i class="fas fa-reply"></i> 回复
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="comment-item">
                <img src="https://picsum.photos/id/64/100/100" alt="用户头像" class="comment-avatar">
                <div class="comment-content">
                    <div class="comment-header">
                        <div class="comment-author">张小明</div>
                        <div class="comment-time">18:48</div>
                    </div>
                    <div class="comment-text">手气不错，抢到了6.66！</div>
                    <div class="comment-actions">
                        <div class="comment-action">
                            <i class="fas fa-heart"></i> 2
                        </div>
                        <div class="comment-action reply-btn">
                            <i class="fas fa-reply"></i> 回复
                        </div>
                    </div>
                    
                    <!-- 回复 -->
                    <div class="replies">
                        <div class="reply-item">
                            <img src="https://picsum.photos/id/22/100/100" alt="回复者头像" class="comment-avatar">
                            <div class="comment-content">
                                <div class="reply-text">
                                    <span class="reply-highlight">@张小明</span> 羡慕了，我才抢到2.33
                                </div>
                                <div class="comment-actions">
                                    <div class="comment-action">
                                        <i class="fas fa-heart"></i> 1
                                    </div>
                                    <div class="comment-action reply-btn">
                                        <i class="fas fa-reply"></i> 回复
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <!-- 底部操作栏 -->
    <div class="bottom-bar">
        <button class="bottom-action">
            <i class="fas fa-thumbs-up"></i>
        </button>
        <input type="text" class="bottom-input" placeholder="写下你的评论...">
        <button class="bottom-action primary">
            <i class="fas fa-paper-plane"></i>
        </button>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // 返回按钮
        document.getElementById('backBtn').addEventListener('click', function() {
            history.back();
        });
        
        // 更多操作按钮
        document.getElementById('moreBtn').addEventListener('click', function() {
            alert('更多红包操作');
        });
        
        // 点赞功能
        const likeButtons = document.querySelectorAll('.comment-action');
        likeButtons.forEach(btn => {
            if (btn.querySelector('.fa-heart')) {
                btn.addEventListener('click', function() {
                    const icon = this.querySelector('i');
                    const countEl = this.childNodes[2];
                    let count = parseInt(countEl.textContent.trim());
                    
                    if (icon.classList.contains('far')) {
                        icon.classList.remove('far');
                        icon.classList.add('fas');
                        this.style.color = 'var(--primary)';
                        countEl.textContent = ` ${count + 1}`;
                    } else {
                        icon.classList.remove('fas');
                        icon.classList.add('far');
                        this.style.color = 'var(--gray)';
                        countEl.textContent = ` ${count - 1}`;
                    }
                });
            }
        });
        
        // 回复功能
        const replyButtons = document.querySelectorAll('.reply-btn');
        const bottomInput = document.querySelector('.bottom-input');
        
        replyButtons.forEach(btn => {
            btn.addEventListener('click', function() {
                const author = this.closest('.comment-content').querySelector('.comment-author').textContent;
                bottomInput.value = `@${author} `;
                bottomInput.focus();
            });
        });
        
        // 发送评论
        const sendButtons = document.querySelectorAll('.send-btn, .bottom-action.primary');
        const commentInput = document.querySelector('.comment-input');
        const commentsList = document.querySelector('.comments-list');
        
        sendButtons.forEach(btn => {
            btn.addEventListener('click', function() {
                let text = '';
                
                // 确定使用哪个输入框的内容
                if (this.classList.contains('send-btn')) {
                    text = commentInput.value.trim();
                } else {
                    text = bottomInput.value.trim();
                }
                
                if (text) {
                    // 创建新评论
                    const newComment = document.createElement('div');
                    newComment.className = 'comment-item';
                    newComment.innerHTML = `
                        <img src="https://picsum.photos/id/237/100/100" alt="你的头像" class="comment-avatar">
                        <div class="comment-content">
                            <div class="comment-header">
                                <div class="comment-author">你</div>
                                <div class="comment-time">刚刚</div>
                            </div>
                            <div class="comment-text">${text}</div>
                            <div class="comment-actions">
                                <div class="comment-action">
                                    <i class="far fa-heart"></i> 0
                                </div>
                                <div class="comment-action reply-btn">
                                    <i class="fas fa-reply"></i> 回复
                                </div>
                            </div>
                        </div>
                    `;
                    
                    // 添加到评论列表顶部
                    commentsList.insertBefore(newComment, commentsList.firstChild);
                    
                    // 清空输入框
                    commentInput.value = '';
                    bottomInput.value = '';
                    
                    // 绑定新评论的事件
                    const newLikeBtn = newComment.querySelector('.comment-action');
                    newLikeBtn.addEventListener('click', function() {
                        const icon = this.querySelector('i');
                        const countEl = this.childNodes[2];
                        let count = parseInt(countEl.textContent.trim() || 0);
                        
                        if (icon.classList.contains('far')) {
                            icon.classList.remove('far');
                            icon.classList.add('fas');
                            this.style.color = 'var(--primary)';
                            countEl.textContent = ` ${count + 1}`;
                        } else {
                            icon.classList.remove('fas');
                            icon.classList.add('far');
                            this.style.color = 'var(--gray)';
                            countEl.textContent = ` ${count - 1}`;
                        }
                    });
                    
                    const newReplyBtn = newComment.querySelector('.reply-btn');
                    newReplyBtn.addEventListener('click', function() {
                        const author = this.closest('.comment-content').querySelector('.comment-author').textContent;
                        bottomInput.value = `@${author} `;
                        bottomInput.focus();
                    });
                }
            });
        });
        
        // 操作按钮功能
        const actionButtons = document.querySelectorAll('.action-btn');
        actionButtons.forEach(btn => {
            btn.addEventListener('click', function() {
                const action = this.textContent.trim();
                if (action.includes('分享')) {
                    alert('分享红包给好友');
                } else if (action.includes('记录')) {
                    alert('查看红包领取记录');
                } else if (action.includes('发红包')) {
                    alert('去发一个新红包');
                }
            });
        });
    </script>
</body>
</html>
